package com.lry.pda.bottom.mysql.backend;

import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

@Data
public class WhereExpr {

    private int index;
    //目前只支持and
    private List<WhereKV> kvs;

    public void addKv(WhereKV whereKV){
        if(CollectionUtils.isEmpty(kvs)){
            kvs = new ArrayList<>();
        }
        kvs.add(whereKV);
        index = kvs.size()-1;
    }

    public WhereKV getKv(){
        return kvs.get(index--);
    }


}
